@extends('admin::layouts.master')
@section('content')
    <form action="{{route('permission',$role['id'])}}" method="post">
        @csrf
        <div class="col-lg-12">
            <div class="card card-border-color card-border-color-warning">
                <div class="card-header">为【{{$role['title']}}】分配权限</div>
                <div class="card-body">
                    @foreach($permission as $v)
                        @foreach($v['rules'] as $vv)
                            <div class="form-group row pt-1 pb-0">
                                <label class="col-12 col-sm-3 col-form-label text-sm-right">{{$vv['group']}}</label>
                                <div class="col-12 col-sm-8 col-lg-6 mt-2">
                                    <div class="form-group">
                                        @foreach($vv['permissions'] as $value)
                                            <label class="custom-control custom-checkbox custom-control-inline">
                                                <input type="checkbox" name="name[]" @if($role->haspermissionto($value['name'])) checked @endif value="{{$value['name']}}" class="custom-control-input is-valid"><span class="custom-control-label">{{$value['title']}}</span>
                                            </label>
                                        @endforeach
                                    </div>
                                </div>
                            </div>
                        @endforeach
                    @endforeach
                </div>
            </div>
            <button type="submit" class="btn btn-space btn-success btn-lg btn-block">保存</button>

        </div>
    </form>

@endsection